library(flowCore)
library(flowStats)
library(flowViz)
library(ggplot2) 
##library(lessR)
##install.packages("lessR")
##library(gridExtra)
##library(multicore)

source("/home/haseong/alpha/dev/FACS/facs_analysis_library.R")



if(.Platform$OS.type=="windows"){
  root<-"D:\\mydocs\\2013\\dev\\ProteinSW\\"
  data.dir<-"D:\\mydocs\\2013\\dev\\ProteinSW\\"
}else{
  root<-"/home/haseong/alpha/dev/FACS/DmpR/"
  data.dir<-"/home/haseong/alpha/dev/FACS/DmpR/20130911/"  
  data.dir2<-"/home/haseong/alpha/dev/FACS/DmpR/20131005_dmpR_E01_400_700/"  
  data.dir3<-"/home/haseong/alpha/dev/FACS/DmpR/20131008_dmpR_E01_400_700/"
  data.dir4<-"/home/haseong/alpha/dev/FACS/DmpR/20131010_dmpR_E01_400/"
  data.dir5<-"/home/haseong/alpha/dev/FACS/DmpR/20131020-dmpR-LB/"
  data.dir6<-"/home/haseong/alpha/dev/FACS/DmpR/20131020-dmpR-M9/"
  data.dir7<-"/home/haseong/alpha/dev/FACS/DmpR/20131021-dmpR-sort/"
}
setwd(root)

x11()
##par(mfrow=c(3,2))

## dir1
pgess.none<-read.FCS(paste(data.dir, "pGESS none.001", sep=""), transformation=FALSE)  
r1<-facs.summary.plot(pgess.none, ncells=10000)
savePlot(filename="pGESS_none.jpg", type="jpeg");

pgess.phenol<-read.FCS(paste(data.dir, "pGESS 100uM phenol.002", sep=""), transformation=FALSE)  
r2<-facs.summary.plot(pgess.phenol, ncells=10000)
savePlot(filename="pGESS_100uM_phenol.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir, "pGEM int phGESS #4 none.005", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="pGEM_int_phGESS_4_none.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir, "pGEM int phGESS #4 100uM ph.006", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="pGEM_int_phGESS_4_100uM_ph.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir, "HK10 none.003", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="HK10_none.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir, "HK10 100uM phenol.004", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="HK10_100uM_phenol.jpg", type="jpeg");



## dir2
ac.5h<-read.FCS(paste(data.dir2, "DmpRA_NC.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.5h, ncells=10000)
savePlot(filename="DmpRA_NC.jpg", type="jpeg");

bc.5h<-read.FCS(paste(data.dir2, "DmpRB_NC.fcs", sep=""), transformation=FALSE) 
rr<-facs.summary.plot(bc.5h, ncells=10000)
savePlot(filename="DmpRB_NC.jpg", type="jpeg");

ap.5h<-read.FCS(paste(data.dir2, "DmpRA_phenol.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.5h, ncells=10000)
savePlot(filename="DmpRA_phenol.jpg", type="jpeg");

bp.5h<-read.FCS(paste(data.dir2, "DmpRB_phenol.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.5h, ncells=10000)
savePlot(filename="DmpRB_phenol.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir2, "DmpRA_pnp.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="DmpRA_pnp.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir2, "DmpRB_pnp.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="DmpRB_pnp.jpg", type="jpeg");



## =================== data3

ac.5h<-read.FCS(paste(data.dir3, "dmpRA_NC.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.5h, ncells=10000)
savePlot(filename="DmpRA_NC2.jpg", type="jpeg");

bc.5h<-read.FCS(paste(data.dir3, "dmpRB_NC.fcs", sep=""), transformation=FALSE) 
rr<-facs.summary.plot(bc.5h, ncells=10000)
savePlot(filename="DmpRB_NC2.jpg", type="jpeg");

ap.5h<-read.FCS(paste(data.dir3, "dmpRA_phenol.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.5h, ncells=10000)
savePlot(filename="DmpRA_phenol2.jpg", type="jpeg");

bp.5h<-read.FCS(paste(data.dir3, "dmpRB_phenol.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.5h, ncells=10000)
savePlot(filename="DmpRB_phenol2.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir3, "dmpRA_pnp.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="DmpRA_pnp2.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir3, "dmpRB_pnp.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="DmpRB_pnp2.jpg", type="jpeg");


## ============ data4 =============================
setwd(data.dir4)
## 700
ac.1h<-read.FCS(paste(data.dir4, "dmpRAC-1500.001", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.1h, ncells=10000)
savePlot(filename="dmpRAC-1500.jpg", type="jpeg");

ap.1h<-read.FCS(paste(data.dir4, "dmpRAP-1500.005", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.1h, ncells=10000)
savePlot(filename="dmpRAP-1500.jpg", type="jpeg");

ac.6h<-read.FCS(paste(data.dir4, "dmpRAC-1950.010", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.6h, ncells=10000)
savePlot(filename="dmpRAC-1950.jpg", type="jpeg");

ap.6h<-read.FCS(paste(data.dir4, "dmpRAP-1950.013", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.6h, ncells=10000)
savePlot(filename="dmpRAP-1950.jpg", type="jpeg");

## B
bc.1h<-read.FCS(paste(data.dir4, "dmpRBC-1500.006", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.1h, ncells=10000)
savePlot(filename="dmpRBC-1500.jpg", type="jpeg");

bp.1h<-read.FCS(paste(data.dir4, "dmpRBP-1500.009", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.1h, ncells=10000)
savePlot(filename="dmpRBP-1500.jpg", type="jpeg");

bc.6h<-read.FCS(paste(data.dir4, "dmpRBC-1950.014", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.6h, ncells=10000)
savePlot(filename="dmpRBC-1950.jpg", type="jpeg");

bp.6h<-read.FCS(paste(data.dir4, "dmpRBP-1950.017", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.6h, ncells=10000)
savePlot(filename="dmpRBP-1950.jpg", type="jpeg");



source("/home/haseong/alpha/dev/FACS/facs_analysis_library.R")
z<-list(tmp1, tmp2, tmp3, tmp4)
tmp<-facs.compare.plot(z, plot.type="FSC")
tmp<-facs.compare.plot(z, plot.type="SSC")
tmp<-facs.compare.plot(z, plot.type="FL1")


## 800
tmp<-read.FCS(paste(data.dir4, "dmpRAC-1500-800.002", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="dmpRAC-1500-800.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir4, "dmpRAP-1500-800.004", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="dmpRAP-1500-800.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir4, "dmpRAC-1950-800.011", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="dmpRAC-1950-800.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir4, "dmpRAP-1950-800.012", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="dmpRAP-1950-800.jpg", type="jpeg");


## 900
tmp<-read.FCS(paste(data.dir4, "dmpRAC-1950-900.021", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="dmpRAC-1950-900.jpg", type="jpeg");

tmp<-read.FCS(paste(data.dir4, "dmpRAP-1950-900.020", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(tmp, ncells=10000)
savePlot(filename="dmpRAP-1950-900.jpg", type="jpeg");




## data5
## =========== LB ===============================
setwd(data.dir5)
ac.1h45<-read.FCS(paste(data.dir5, "dmpRAC-1345-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.1h45, ncells=10000)
savePlot(filename="dmpRAC-1345-700.jpg", type="jpeg");

ap.1h45<-read.FCS(paste(data.dir5, "dmpRAP-1345-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.1h45, ncells=10000)
savePlot(filename="dmpRAP-1345-700.jpg", type="jpeg");

bc.1h45<-read.FCS(paste(data.dir5, "dmpRBC-1345-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.1h45, ncells=10000)
savePlot(filename="dmpRBC-1345-700.jpg", type="jpeg");

bp.1h45<-read.FCS(paste(data.dir5, "dmpRBP-1345-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.1h45, ncells=10000)
savePlot(filename="dmpRBP-1345-700.jpg", type="jpeg");


## 1530
ac.4h30<-read.FCS(paste(data.dir5, "dmpRAC-1530-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.4h30, ncells=10000)
savePlot(filename="dmpRAC-1530-700.jpg", type="jpeg");

ap.4h30<-read.FCS(paste(data.dir5, "dmpRAP-1530-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.4h30, ncells=10000)
savePlot(filename="dmpRAP-1530-700.jpg", type="jpeg");

bc.4h30<-read.FCS(paste(data.dir5, "dmpRBC-1530-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.4h30, ncells=10000)
savePlot(filename="dmpRBC-1530-700.jpg", type="jpeg");

bp.4h30<-read.FCS(paste(data.dir5, "dmpRBP-1530-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.4h30, ncells=10000)
savePlot(filename="dmpRBP-1530-700.jpg", type="jpeg");

## 1730
ac.6h30<-read.FCS(paste(data.dir5, "dmpRAC-1730-LB.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.6h30, ncells=10000)
savePlot(filename="dmpRAC-1730-LB.jpg", type="jpeg");

ap.6h30<-read.FCS(paste(data.dir5, "dmpRAP-1730-LB.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.6h30, ncells=10000)
savePlot(filename="dmpRAP-1730-LB.jpg", type="jpeg");

bc.6h30<-read.FCS(paste(data.dir5, "dmpRBC-1730-LB.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.6h30, ncells=10000)
savePlot(filename="dmpRBC-1730-LB.jpg", type="jpeg");

bp.6h30<-read.FCS(paste(data.dir5, "dmpRBP-1730-LB.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.6h30, ncells=10000)
savePlot(filename="dmpRBP-1730-LB.jpg", type="jpeg");

## 2130
ac.10h30<-read.FCS(paste(data.dir5, "dmpRAC-2130-LB.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.10h30, ncells=10000)
savePlot(filename="dmpRAC-2130-LB.jpg", type="jpeg");

ap.10h30<-read.FCS(paste(data.dir5, "dmpRAP-2130-LB.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.10h30, ncells=10000)
savePlot(filename="dmpRAP-2130-LB.jpg", type="jpeg");

bc.10h30<-read.FCS(paste(data.dir5, "dmpRBC-2130-LB.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.10h30, ncells=10000)
savePlot(filename="dmpRBC-2130-LB.jpg", type="jpeg");

bp.10h30<-read.FCS(paste(data.dir5, "dmpRBP-2130-LB.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.10h30, ncells=10000)
savePlot(filename="dmpRBP-2130-LB.jpg", type="jpeg");

source("/home/haseong/alpha/dev/FACS/facs_analysis_library.R")
## FSC
za<-list(ac.1h, ap.1h, ap.1h45, ap.4h30, ap.5h, ap.6h, ap.6h30, ap.10h30)
names(za)<-paste("DmpRA LB ",  c(0, "1h", "1h45m", "4h30m", "5h", "6h", "6h30m", "10h30m"), sep="")
tmp<-facs.compare.plot(za, plot.type="FSC")
tmp<-facs.compare.plot(za, plot.type="SSC")
tmp<-facs.compare.plot(za, plot.type="FL1")


##zb<-list(tmp3, tmp4, tmp8, tmp12, tmp16)
zb<-list(bc.1h, bp.1h, bp.1h45, bp.4h30, bp.5h, bp.6h, bp.6h30, bp.10h30)
names(zb)<-paste("DmpRA LB ",  c(0, "1h", "1h45m", "4h30m", "5h", "6h", "6h30m", "10h30m"), sep="")
##names(zb)<-paste("DmpRB LB ",  c(0,"1h45m", "4h30m", "6h30m", "10h30m"), sep="")
tmp<-facs.compare.plot(zb, plot.type="FSC")
tmp<-facs.compare.plot(zb, plot.type="SSC")
tmp<-facs.compare.plot(zb, plot.type="FL1")



## data6
## ======================  M9  =====================================
setwd(data.dir6)
ac.4h30d<-read.FCS(paste(data.dir6, "dmpRAC-1530-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.4h30d, ncells=10000)
savePlot(filename="dmpRAC-1530-700.jpg", type="jpeg");

ap.4h30d<-read.FCS(paste(data.dir6, "dmpRAP-1530-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.4h30d, ncells=10000)
savePlot(filename="dmpRAP-1530-700.jpg", type="jpeg");

bc.4h30d<-read.FCS(paste(data.dir6, "dmpRBC-1530-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.4h30d, ncells=10000)
savePlot(filename="dmpRBC-1530-700.jpg", type="jpeg");

bp.4h30d<-read.FCS(paste(data.dir6, "dmpRBP-1530-700.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.4h30d, ncells=10000)
savePlot(filename="dmpRBP-1530-700.jpg", type="jpeg");

## -- 1730
ac.6h30<-read.FCS(paste(data.dir6, "dmpRAC-1730.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.6h30, ncells=10000)
savePlot(filename="dmpRAC-1730.jpg", type="jpeg");

ap.6h30<-read.FCS(paste(data.dir6, "dmpRAP-1730.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.6h30, ncells=10000)
savePlot(filename="dmpRAP-1730.jpg", type="jpeg");

bc.6h30<-read.FCS(paste(data.dir6, "dmpRBC-1730.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.6h30, ncells=10000)
savePlot(filename="dmpRBC-1730.jpg", type="jpeg");

bp.6h30<-read.FCS(paste(data.dir6, "dmpRBP-1730.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.6h30, ncells=10000)
savePlot(filename="dmpRBP-1730.jpg", type="jpeg");

## -- 2130
ac.10h30<-read.FCS(paste(data.dir6, "dmpRAC-2130.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.10h30, ncells=10000)
savePlot(filename="dmpRAC-2130.jpg", type="jpeg");

ap.10h30<-read.FCS(paste(data.dir6, "dmpRAP-2130.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.10h30, ncells=10000)
savePlot(filename="dmpRAP-2130.jpg", type="jpeg");

bc.10h30<-read.FCS(paste(data.dir6, "dmpRBC-2130.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.10h30, ncells=10000)
savePlot(filename="dmpRBC-2130.jpg", type="jpeg");

bp.10h30<-read.FCS(paste(data.dir6, "dmpRBP-2130.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.10h30, ncells=10000)
savePlot(filename="dmpRBP-2130.jpg", type="jpeg");


## -- 3D
ac.3d<-read.FCS(paste(data.dir6, "dmpRAC-3D.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.3d, ncells=10000)
savePlot(filename="dmpRAC-3d.jpg", type="jpeg");

ap.3d<-read.FCS(paste(data.dir6, "dmpRAP-3D.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.3d, ncells=10000)
savePlot(filename="dmpRAP-3d.jpg", type="jpeg");

bc.3d<-read.FCS(paste(data.dir6, "dmpRBC-3D.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.3d, ncells=10000)
savePlot(filename="dmpRBC-3d.jpg", type="jpeg");

bp.3d<-read.FCS(paste(data.dir6, "dmpRBP-3D.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.32, ncells=10000)
savePlot(filename="dmpRBP-3d.jpg", type="jpeg");



## data7
## ======================  M9  =====================================
setwd(data.dir7)
ac.1h30<-read.FCS(paste(data.dir7, "dmpRAC-1h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.1h30, ncells=10000)
savePlot(filename="dmpRAC-1h30.jpg", type="jpeg");

ap.1h30<-read.FCS(paste(data.dir7, "dmpRAP-1h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.1h30, ncells=10000)
savePlot(filename="dmpRAP-1h30.jpg", type="jpeg");

bc.1h30<-read.FCS(paste(data.dir7, "dmpRBC-1h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.1h30, ncells=10000)
savePlot(filename="dmpRBC-1h30.jpg", type="jpeg");

bp.1h30<-read.FCS(paste(data.dir7, "dmpRBP-1h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.1h30, ncells=10000)
savePlot(filename="dmpRBP-1h30.jpg", type="jpeg");

## -- 2h30
ac.2h30<-read.FCS(paste(data.dir7, "dmpRAC-2h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.2h30, ncells=10000)
savePlot(filename="dmpRAC-2h30.jpg", type="jpeg");

ap.2h30<-read.FCS(paste(data.dir7, "dmpRAP-2h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.2h30, ncells=10000)
savePlot(filename="dmpRAP-2h30.jpg", type="jpeg");

bc.2h30<-read.FCS(paste(data.dir7, "dmpRBC-2h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.2h30, ncells=10000)
savePlot(filename="dmpRBC-2h30.jpg", type="jpeg");

bp.2h30<-read.FCS(paste(data.dir7, "dmpRBP-2h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.2h30, ncells=10000)
savePlot(filename="dmpRBP-2h30.jpg", type="jpeg");

## -- 3h30
ac.3h30<-read.FCS(paste(data.dir7, "dmpRAC-3h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.3h30, ncells=10000)
savePlot(filename="dmpRAC-3h30.jpg", type="jpeg");

ap.3h30<-read.FCS(paste(data.dir7, "dmpRAP-3h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.3h30, ncells=10000)
savePlot(filename="dmpRAP-3h30.jpg", type="jpeg");

bc.3h30<-read.FCS(paste(data.dir7, "dmpRBC-3h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.3h30, ncells=10000)
savePlot(filename="dmpRBC-3h30.jpg", type="jpeg");

bp.3h30<-read.FCS(paste(data.dir7, "dmpRBP-3h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.3h30, ncells=10000)
savePlot(filename="dmpRBP-3h30.jpg", type="jpeg");


## -- 4h30
ac.4h30<-read.FCS(paste(data.dir7, "dmpRAC-4h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.4h30, ncells=10000)
savePlot(filename="dmpRAC-4h30.jpg", type="jpeg");

ap.4h30<-read.FCS(paste(data.dir7, "dmpRAP-4h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.4h30, ncells=10000)
savePlot(filename="dmpRAP-4h30.jpg", type="jpeg");

bc.4h30<-read.FCS(paste(data.dir7, "dmpRBC-4h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.4h30, ncells=10000)
savePlot(filename="dmpRBC-4h30.jpg", type="jpeg");

bp.4h30<-read.FCS(paste(data.dir7, "dmpRBP-4h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.4h30, ncells=10000)
savePlot(filename="dmpRBP-4h30.jpg", type="jpeg");

## -- 6h30
ac.6h20<-read.FCS(paste(data.dir7, "dmpRAC-6h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ac.6h20, ncells=10000)
savePlot(filename="dmpRAC-6h20.jpg", type="jpeg");

ap.6h20<-read.FCS(paste(data.dir7, "dmpRAP-6h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(ap.6h20, ncells=10000)
savePlot(filename="dmpRAP-6h20.jpg", type="jpeg");

bc.6h20<-read.FCS(paste(data.dir7, "dmpRBC-6h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bc.6h20, ncells=10000)
savePlot(filename="dmpRBC-6h20.jpg", type="jpeg");

bp.6h20<-read.FCS(paste(data.dir7, "dmpRBP-6h30.fcs", sep=""), transformation=FALSE)  
rr<-facs.summary.plot(bp.6h20, ncells=10000)
savePlot(filename="dmpRBP-6h20.jpg", type="jpeg");




source("/home/haseong/alpha/dev/FACS/facs_analysis_library.R")
## FSC
za<-list(ac.1h, ap.1h, ap.1h30, ap.1h45, ap.2h30, ap.3h30, ap.4h30, ap.4h30d, ap.5h, ap.6h, ap.6h20, ap.6h30, ap.10h30, ap.3d)
##names(za)<-paste("DmpRA ",  c(0, "1h", "1h30", "1h45m", "2h30", "3h30", "4h30m", "5h", "6h", "6h30m", "10h30m", "3D"), sep="")
names(za)<-c("0", "60", "90", "105", "150", "210", "270", "271", "300", "350", "360", "390", "630", "900")
tmp<-facs.compare.plot(za, plot.type="FSC")
tmp<-facs.compare.plot(za, plot.type="SSC")
tmp<-facs.compare.plot(za, plot.type="FL1")

tmp<-facs.sumcom.plot(za, plot.type="FL1")


##zb<-list(tmp3, tmp4, tmp8, tmp12, tmp16)
zb<-list(bc.1h, bp.1h, bp.1h30, bp.1h45, bp.2h30, bp.3h30, bp.4h30, ap.4h30d, bp.5h, bp.6h, bp.6h20, bp.6h30, bp.10h30, bp.3d)
names(zb)<-c("0", "60", "90", "105", "150", "210", "270", "271", "300", "350", "360", "390", "630", "900")
##names(zb)<-paste("DmpRB ",  c(0,"1h45m", "4h30m", "6h30m", "10h30m"), sep="")
tmp<-facs.compare.plot(zb, plot.type="FSC")
tmp<-facs.compare.plot(zb, plot.type="SSC")
tmp<-facs.compare.plot(zb, plot.type="FL1")


tmp<-facs.sumcom.plot(zb, plot.type="FL1")




## FSC
za<-list(tmp1, tmp2, tmp6, tmp10)
names(za)<-paste("DmpRA LB ",  c(0,"2h30m", "4h30m", "6h30m"), sep="")
tmp<-facs.compare.plot(za, plot.type="FSC")
tmp<-facs.compare.plot(za, plot.type="SSC")
tmp<-facs.compare.plot(za, plot.type="FL1")

zb<-list(tmp3, tmp4, tmp8, tmp12)
names(zb)<-paste("DmpRA LB ",  c(0,"2h30m", "4h30m", "6h30m"), sep="")
tmp<-facs.compare.plot(zb, plot.type="FSC")
tmp<-facs.compare.plot(zb, plot.type="SSC")
tmp<-facs.compare.plot(zb, plot.type="FL1")









